UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QUILjLj8uQjnaiARAJFmOr0E40GxdGdK88n6pzzXaWc=' 
WHERE 
  key_id = '796e4b8c407a8d8d5ed6e40893f2ce5caacc0f57468ceb03091198e0fb49552d' 
  AND (
    token = 'QUILjLj8uQjnaiARAJFmOr0E40GxdGdK88n6pzzXaWc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022