UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KVGwt8kX7aTku5raRLztt1BvrQFfIHXzfo5rSTELFso=' 
WHERE 
  key_id = '0442790b6e9699e3f3474f0fdefe0098b3fc2c1808a7a455ba93ddb9d73822ed' 
  AND (
    token = 'KVGwt8kX7aTku5raRLztt1BvrQFfIHXzfo5rSTELFso=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035