UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'meYFQxI0bZBOPHVEBOAZHy33PbI35JMnWeTPmdWxRc4=' 
WHERE 
  key_id = '7c2c0a55074735771073dbf352b68affae0b27befd88405a6deef113307f8687' 
  AND (
    token = 'meYFQxI0bZBOPHVEBOAZHy33PbI35JMnWeTPmdWxRc4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023