UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZjhSCT/k2hkllzb2kQIvGSQGCFtIy5ctdydz9uGeIo4=' 
WHERE 
  key_id = '7d97dfa578fa5df25c9c0b79111d436fb182efe54d043af83a728a8e05253469' 
  AND (
    token = 'ZjhSCT/k2hkllzb2kQIvGSQGCFtIy5ctdydz9uGeIo4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020