UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W9rU09rJ893mP7Hjwaq/IUlNJr3EDFfXsxRP6ivzAXU=' 
WHERE 
  key_id = '16794db20dc647374b380adbb583b10aa598842c8a5c5cf79b25db2cc92e81c8' 
  AND (
    token = 'W9rU09rJ893mP7Hjwaq/IUlNJr3EDFfXsxRP6ivzAXU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019