UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eLfTccYwpVWm1BbI0ZY5zUXw5FAgt4Hy7sOowO3Am/Q=' 
WHERE 
  key_id = '1b1657d4adee98390a5fcf01159af799ae4557f9abdad035cf5dd39f294ab4ad' 
  AND (
    token = 'eLfTccYwpVWm1BbI0ZY5zUXw5FAgt4Hy7sOowO3Am/Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054