UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm8OnHIQUSL4siuUCq97IQQBRxTmJCKw24bJh7qdvn7U=' 
WHERE 
  key_id = '5722e1b71517969fe2fbc8d920d1d0ba863c1d5cd0999d233588e167f200532c' 
  AND (
    token = 'm8OnHIQUSL4siuUCq97IQQBRxTmJCKw24bJh7qdvn7U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00063