UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R8Dw9MjaOA6jpoVucXiKy3ddeBiwZGvX5KAIOFwYqGU=' 
WHERE 
  key_id = '0b235d9975c0410df4a4b292799a833d969ca69238aa162e0c0584627622f1c3' 
  AND (
    token = 'R8Dw9MjaOA6jpoVucXiKy3ddeBiwZGvX5KAIOFwYqGU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017