UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lbFb08kh2PkDTbK9s+dgROt0WWEa0+ibEBSW5mawiXE=' 
WHERE 
  key_id = '8e820b28308bdd8095f773fa547ed23546dd8c3bd3b7e18d7207dfebeaba5991' 
  AND (
    token = 'lbFb08kh2PkDTbK9s+dgROt0WWEa0+ibEBSW5mawiXE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038