UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0hq9pxuowq9A6jTy/sKAOqxG6uUP5xp0THOPvZ5+8pk=' 
WHERE 
  key_id = '987f8e9ad69fc3e56b381b1ef7a5f5e01fb5c72e2adc4e278a7a7ee013afa482' 
  AND (
    token = '0hq9pxuowq9A6jTy/sKAOqxG6uUP5xp0THOPvZ5+8pk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025