UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fu5Z+kX/nVhMU+CpH7ynFXV9psXGoJhbnmmUVyAHryk=' 
WHERE 
  key_id = 'd936166714e99c24e4f8632732ca8af1d5570e14c0e73d20e6631ee87857eacf' 
  AND (
    token = 'fu5Z+kX/nVhMU+CpH7ynFXV9psXGoJhbnmmUVyAHryk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043