UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xgL5ImGWBQMsZWMQlSxlv83GKiliMPw58juMeMSZLS4=' 
WHERE 
  key_id = 'e24f8cab61b2bcf12731680be29013788df00ea9f2ef0bf152b38ff5b6adffcb' 
  AND (
    token = 'xgL5ImGWBQMsZWMQlSxlv83GKiliMPw58juMeMSZLS4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044