UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FMXboR8coKUrUy0qm23DueozUPiQf0av1drn2eUa5zs=' 
WHERE 
  key_id = '8041e5daf70f83f61956884eeabb17db4262e9a50d27e39f8712a9545690928a' 
  AND (
    token = 'FMXboR8coKUrUy0qm23DueozUPiQf0av1drn2eUa5zs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025