UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fXRm/R7gtAEvOpGfURdWtzmIZ2GMvbYBJknNVqLCnKo=' 
WHERE 
  key_id = 'b9415b22e9c0791a041c535e52dfa3060718b10922fddd5576d29d5f6bc0f7e2' 
  AND (
    token = 'fXRm/R7gtAEvOpGfURdWtzmIZ2GMvbYBJknNVqLCnKo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032