UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RAE4K7reHUW+FiNrJtind8r6XxzET+AattbcdGUGvgI=' 
WHERE 
  key_id = 'b7f97050db37dc0310c66d6b947d2dd1e01574ea5ff8ac5c5dae459ad3e3d5ee' 
  AND (
    token = 'RAE4K7reHUW+FiNrJtind8r6XxzET+AattbcdGUGvgI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057