UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MWV93VenKngk2RSRzdVPvpfznsdC6shb28qb8kr/zfc=' 
WHERE 
  key_id = 'e4121a426045ccdb1abe2c07319f84cc6b9dca576ebaf752d5f5c0f78b2f7e24' 
  AND (
    token = 'MWV93VenKngk2RSRzdVPvpfznsdC6shb28qb8kr/zfc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034