UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hpn1O3nybArZqJx2xRxRWWS0Ft+wAR1QcWJH0kS/ayg=' 
WHERE 
  key_id = '4bdf6afba488c816d639d5cc68859b97c94d5dd7bb7b578c43cf4b0b795c2bb2' 
  AND (
    token = 'hpn1O3nybArZqJx2xRxRWWS0Ft+wAR1QcWJH0kS/ayg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045