UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JWDT0m93CrvgLfArMOs+BjXNY/tnUwOkBUb/ulxQsIY=' 
WHERE 
  key_id = '5ff1fca7b6e1573ad7b8b68d96986b697549da134d52c19017f1b264a69efa14' 
  AND (
    token = 'JWDT0m93CrvgLfArMOs+BjXNY/tnUwOkBUb/ulxQsIY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030