UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AKjKG52eQX0mp4zpUd3sq5+xaRLKrz1aJPuweoicXTM=' 
WHERE 
  key_id = 'cca7efcc28ba89aa088c7b274152ad0f9476be934720adf79569f388b063fead' 
  AND (
    token = 'AKjKG52eQX0mp4zpUd3sq5+xaRLKrz1aJPuweoicXTM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027