UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mM8laY1010xCCuUc+6ZfA+BbBDs+yqL2IBR5Q95MfwQ=' 
WHERE 
  key_id = '0b346f7ecf44386cf9f813e863269d9cd833c14246a08b8233bf500c37971e43' 
  AND (
    token = 'mM8laY1010xCCuUc+6ZfA+BbBDs+yqL2IBR5Q95MfwQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039