UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sSyUztvzs/vSogOEg40dvTkCw8byGEOOfrJcSlTOLxQ=' 
WHERE 
  key_id = 'ab0be744a3fda8ea541088df9512ad38f7cd9ccf63d4ea5ac73b12e7a3220720' 
  AND (
    token = 'sSyUztvzs/vSogOEg40dvTkCw8byGEOOfrJcSlTOLxQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023