UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uHl7+dei9UoP6KcAJTTIH8RGVubhehBhF9niezns+fo=' 
WHERE 
  key_id = '663f393e8744927ee68a051b08f336dd05290775472a1976ea23f57851db0587' 
  AND (
    token = 'uHl7+dei9UoP6KcAJTTIH8RGVubhehBhF9niezns+fo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00072