UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BTdhyLK7MxsdNRS438C1Yo859qmA6oGN/BBmwZzivzg=' 
WHERE 
  key_id = '054530bfd7ca35618e936f6eae0fb13fc175749ddb3c74b8943159fbcaa3c773' 
  AND (
    token = 'BTdhyLK7MxsdNRS438C1Yo859qmA6oGN/BBmwZzivzg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031