UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hqCg0BcCglRQLcZYJL47xihPD8FfvQICNc+0N5DZ4xU=' 
WHERE 
  key_id = '68260e08e7ba9fd2105edfcb77ccd166e1532fccd9ae0caed902916000fbda66' 
  AND (
    token = 'hqCg0BcCglRQLcZYJL47xihPD8FfvQICNc+0N5DZ4xU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048