UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VPHR2X2eIVBpC93SRvTiv9rDPPUns7h8QRQA9qaMVYM=' 
WHERE 
  key_id = '5a2fe7f52cc783d045febb4ef841bb21ea5176afc49ec7ee77dcf50938f6f925' 
  AND (
    token = 'VPHR2X2eIVBpC93SRvTiv9rDPPUns7h8QRQA9qaMVYM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032