UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3EpgKaLTW13cjeRPjAYY2nMm2tOV+ruv/rsT5DZgazg=' 
WHERE 
  key_id = 'b938f4de61e96d725012406addd61c477825e860704a08c3d001319d4dfb898c' 
  AND (
    token = '3EpgKaLTW13cjeRPjAYY2nMm2tOV+ruv/rsT5DZgazg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028