UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'B3F/H9cRkUvgBo/YSNfxalk7VO02LquoGKsZ+ptCde4=' 
WHERE 
  key_id = '357ffff8fe7d297c60561978f99e1bd1cd29f8744567247c28928655e6df1eb8' 
  AND (
    token = 'B3F/H9cRkUvgBo/YSNfxalk7VO02LquoGKsZ+ptCde4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034