UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TicoFC20n2amA8U7gK5PvgPw0yjNPWoH1xrrVUQxx7M=' 
WHERE 
  key_id = '585069b21d431e462964dea9759da508e48c43d39961076bafbcc1e89c670da0' 
  AND (
    token = 'TicoFC20n2amA8U7gK5PvgPw0yjNPWoH1xrrVUQxx7M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041