UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pHPRDePbzUy8UmPXzzfzKwyEFE7PYh2tmvl279hnUvo=' 
WHERE 
  key_id = '3f8ff13e1f9b40f08891fd5597bce34bfb69bc71b01154b106a2afbe643f6111' 
  AND (
    token = 'pHPRDePbzUy8UmPXzzfzKwyEFE7PYh2tmvl279hnUvo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024