UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DS0hoozT1rAwAyxID3lyACrFBW54EnBDaVMylC5jd1U=' 
WHERE 
  key_id = 'be623e8eb8ea93323ea6227338dbd125c0b3bd17327006d035d3e37bc6460de7' 
  AND (
    token = 'DS0hoozT1rAwAyxID3lyACrFBW54EnBDaVMylC5jd1U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024