UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aS+3XDhKddzF578o/5AfMCVl2CiqyaT/N2ytFPG0OrM=' 
WHERE 
  key_id = '3c544b701242664650f03ba5bd4343bbde48ad727b031ba5ff82708f202c99ed' 
  AND (
    token = 'aS+3XDhKddzF578o/5AfMCVl2CiqyaT/N2ytFPG0OrM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032